import React, { Component } from 'react'
import {  View,StyleSheet, ScrollView,NativeModules,Platform } from 'react-native'
import UserInfo from '../../components/UserInfo'

import { MyOrder }from '../../components/MyOrder'
import  EquityCom from '../../components/EquityCom'
import MyCenterCom from '@/components/MyCenterCom'

import type { Props } from '@/types/user'

export default class my extends Component {
  memberCenter:Props = {
    title:'会员中心',
    data:[
      {id:10011,source:require('../../assets/icons/myFans.png'),text:'我的粉丝',width:26,height:22},
      {id:10012,source:require('../../assets/icons/myVip.png'),text:'我的VIP',width:23,height:22},
      {id:10013,source:require('../../assets/icons/inviteFriends.png'),text:'邀请好友',width:23,height:20},
      {id:10014,source:require('../../assets/icons/tutorWechat.png'),text:'导师微信',width:24,height:21},
      {id:10015,source:require('../../assets/icons/vipEquity.png'),text:'VIP权益',width:23,height:21},
    ]
  }
  lifeService:Props = {
    title:'生活服务',
    data:[
      {id:10021,source:require('../../assets/icons/voucherCenter.png'),text:'充值中心',width:15,height:23},
      {id:10022,source:require('../../assets/icons/joinUs.png'),text:'成为拓客'},
      {id:10023,source:require('../../assets/icons/shoppingCar.png'),text:'购物车',width:26},
      {id:10024,source:require('../../assets/icons/favorite.png'),text:'收藏夹'},
      {id:10025,source:require('../../assets/icons/orderIn.png'),text:'订单找回',width:18,height:20},
      {id:10026,source:require('../../assets/icons/discountCenter.png'),text:'领券中心',width:21,height:16},
      {id:10027,source:require('../../assets/icons/minApplication.png'),text:'小程序'},
      {id:10028,source:require('../../assets/icons/helpAndService.png'),text:'帮助与客服',width:23,height:21},
      {id:10029,source:require('../../assets/icons/redBag.png'),text:'领红包',width:18,height:21},
      {id:10030,source:require('../../assets/icons/fishFarm.png'),text:'飞鱼农场',width:30,height:26},
    ]
  }
  promotionTools:Props = {
    title:'地推工具',
    data:[
      {id:10031,source:require('../../assets/icons/newHandCourse.png'),text:'新手教程',width:19,height:21},
      {id:10032,source:require('../../assets/icons/material.png'),text:'地推物料',width:23,height:22},
      {id:10033,source:require('../../assets/icons/rules.png'),text:'推广规则'},
      {id:10034,source:require('../../assets/icons/question.png'),text:'常见问题',},
      {id:10035,source:require('../../assets/icons/inMall.png'),text:'成为商家'},
      {id:10036,source:require('../../assets/icons/business.png'),text:'商务合作',width:24,height:20},
      {id:10037,source:require('../../assets/icons/aboutUs.png'),text:'关于我们'},
    ]
  }
  // 获取底部安全区高度（iOS 11+）
  
  render() {
    const safeAreaInsets = Platform.OS === 'ios'
  ? (() => {
      const window = NativeModules.UIKit?.UIApplication.sharedApplication()?.windows?.[0];
      return window?.safeAreaInsets?.bottom || 0;
    })()
  : 0;
  // 计算底部 NavBar 高度
  const navBarHeight = Platform.OS === 'ios' ? 44 + safeAreaInsets : 0;
    return (
        <ScrollView>
          <UserInfo />
          <View style={{justifyContent:'center',paddingLeft:15,paddingRight:15}}>
            <MyOrder></MyOrder>
            <EquityCom></EquityCom>
            <MyCenterCom {...this.memberCenter}/>
            <MyCenterCom {...this.lifeService}/>
            <MyCenterCom {...this.promotionTools}/>
          </View>
          <View style={{height:navBarHeight}}></View>
        </ScrollView> 
    )
  }
}
